const squareApi = {
    /**
     * 广场配置
     *
     * @author zero
     */
    setting(): Promise<SquareSettingResponse[]> {
        return $request.get<SquareSettingResponse[]>({
            url: '/square/setting'
        })
    },

    /**
     * 广场分类
     *
     * @param {string} type 分类场景
     * @author zero
     */
    category(type: string): Promise<SquareCategoryResponse[]> {
        return $request.get<SquareCategoryResponse[]>({
            url: '/square/category',
            params: {
                type
            }
        })
    },

    /**
     * 智能体广场
     *
     * @param {Object} params
     * @param {number} [params.page_no] 当前页码
     * @param {number} [params.page_size] 每页条数
     * @param {number} [params.cate] 类目ID
     * @param {string} [params.keyword] 关键词
     * @author zero
     */
    robot(params: {
        page_no?: number;
        page_size?: number;
        cate?: number;
        keyword?: string;
    }): Promise<SquareRobotResponse[]> {
        const data: any = {}
        if (params.cate) {
            data.cate = params.cate
        }
        if (params.keyword) {
            data.keyword = params.keyword
        }
        return $request.get<SquareRobotResponse[]>({
            url: '/square/robot',
            params: data
        })
    },

    /**
     * 绘画广场
     *
     * @param {Object} params
     * @param {number} [params.page_no] 当前页码
     * @param {number} [params.page_size] 每页条数
     * @param {number} [params.cate] 类目ID
     * @param {string} [params.keyword] 关键词
     * @author zero
     */
    draws(params: {
        page_no?: number;
        page_size?: number;
        cate?: number;
        keyword?: string;
    }): Promise<SquareDrawsResponse[]> {
        const data: any = {}
        if (params.cate) {
            data.cate = params.cate
        }
        if (params.keyword) {
            data.keyword = params.keyword
        }
        return $request.get<SquareDrawsResponse[]>({
            url: '/square/draws',
            params: data
        })
    },

    /**
     * 视频广场
     *
     * @param {Object} params
     * @param {number} [params.page_no] 当前页码
     * @param {number} [params.page_size] 每页条数
     * @param {number} [params.cate] 类目ID
     * @param {string} [params.keyword] 关键词
     * @author zero
     */
    video(params: {
        page_no?: number;
        page_size?: number;
        cate?: number;
        keyword?: string;
    }): Promise<SquareVideoResponse[]> {
        const data: any = {}
        if (params.cate) {
            data.cate = params.cate
        }
        if (params.keyword) {
            data.keyword = params.keyword
        }
        return $request.get<SquareVideoResponse[]>({
            url: '/square/video',
            params: data
        })
    },

    /**
     * 音乐广场
     *
     * @param {Object} params
     * @param {number} [params.page_no] 当前页码
     * @param {number} [params.page_size] 每页条数
     * @param {number} [params.cate] 类目ID
     * @param {string} [params.keyword] 关键词
     * @author zero
     */
    music(params: {
        page_no?: number;
        page_size?: number;
        cate?: number;
        keyword?: string;
    }): Promise<SquareMusicResponse[]> {
        const data: any = {}
        if (params.cate) {
            data.cate = params.cate
        }
        if (params.keyword) {
            data.keyword = params.keyword
        }
        return $request.get<SquareMusicResponse[]>({
            url: '/square/music',
            params: data
        })
    }
}

export default squareApi
